<script setup>
  defineProps({
    topInfos: {
      type: Object,
      default: () => ({})
    }
  })
</script>

<template>
  <div class="detailInfos">
    <div class="box title">{{ topInfos.houseName }}</div>

    <div class="box tags">
      <template v-for="(item,index) in topInfos.houseTags" :key="index">
        <span class="tagsItem" v-if="item.tagText"
              :style="{color:item.tagText.color,
                  background:item.tagText.background.color}">
          {{ item.tagText.text }}
        </span>
      </template>
    </div>

    <div class="box line comment">
      <div class="left">
        <span class="score">{{ topInfos.commentBrief.overall }}</span>
        <span class="evaluate">{{ topInfos.commentBrief.scoreTitle }}</span>
        <span class="brief">{{ topInfos.commentBrief.commentBrief }}</span>
      </div>
      <div class="right">
        <span class="text">{{ topInfos.commentBrief.totalCount }}条评论</span>
        <van-icon name="arrow"/>
      </div>
    </div>

    <div class="box line location">
      <div class="left">{{ topInfos.nearByPosition.address }}</div>
      <div class="right">
        <span class="text">地图·周边</span>
        <van-icon name="arrow"/>
      </div>
    </div>

  </div>
</template>

<style lang="less" scoped>
  .detailInfos {
    padding: 0 14px 20px;

    .box {
      margin: 14px 0;
    }

    div, span {
      display: flex;
    }

    .title {
      font-size: 20px;
      text-align: justify;
    }

    .tags {
      margin-top: -7px;
      font-size: 12px;
      flex-wrap: wrap;

      .tagsItem {
        height: 1.3em;
        padding: 2px 4px;
        margin-top: 7px;
        margin-right: 6px;
        align-items: center;
      }
    }

    .line {
      padding: 8px 10px;
      justify-content: space-between;
      background: var(--auxiliary-back-color);
      border-radius: var(--card-border-radius);
      align-items: center;

      span {
        padding-right: 3px;
      }

      .left {
        align-items: flex-end;
        .score {
          font-size: 18px;
          font-weight: bold;
        }

        .evaluate {
          font-size: 12px;
          font-weight: bold;
          margin-bottom: 1px;
        }

        .brief {
          font-size: 12px;
          color: var(--auxiliary-text-color);
          margin-bottom: 1px;
        }
      }

      .right {
        font-size: 12px;
        color: var(--primary-color);
        align-items: center;
      }
    }

    .location {
      .left {
        padding-top: 1px;
      }
    }
  }
</style>